BinaryTree.## S3 method for class 'BinaryTree':
plot(x, main = NULL,
type = c("extended", "simple"), terminal_panel = NULL,
inner_panel = node_inner, edge_panel = edge_simple,
drop_terminal = (type[1] == "extended"),
tnex = (type[1] == "extended") + 1, newpage = TRUE,
pop = TRUE, ...)BinaryTree.extended tries to visualize the distribution of the
response variable in each terminal node whereas simple
only gives some summary ifunction(node) plotting the terminal nodes.
Alternatively, a panel generating function of the form
function(ctreeobj, ...function(node) plotting the inner nodes.function(split, ordered = FALSE, left = TRUE)
plotting the edges.grid.newpage() should be called.plot method for BinaryTree objects provides an
extensible framework for the visualization of binary regression trees. The
user is allowed to specify panel functions for plotting terminal and inner
nodes as well as the corresponding edges. Panel functions for plotting
inner nodes, edges and terminal nodes are available for the most important
cases and can serve as the basis for user-supplied extensions, see
node_inner.data(airquality)
airq <- subset(airquality, !is.na(Ozone))
airct <- ctree(Ozone ~ ., data = airq)
### boxplots in each node
plot(airct, terminal_panel = node_boxplot, drop_terminal = TRUE)Run the code above in your browser using DataLab